package com.mall.manager.service;

import java.util.List;

import org.springframework.stereotype.Service;

import com.mall.common.dao.MongoDBManager;
import com.mall.untils.DateUtils;
import com.mongodb.BasicDBList;
import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;

@Service
public class AbilityStatistiService {

	/**
	 * 查询八大能力信息
	 * @param collection 表名
	 * @return
	 */
	public List<DBObject> findMongodbReview(String collection){
		//当前日期的前一天
		String beforDate = DateUtils.getNowBeforDay();	
		BasicDBList list = new BasicDBList();
		//按时间检索前一天的数据
		BasicDBObject dbo = new BasicDBObject();
		dbo.put("ut", new BasicDBObject("$gte", beforDate+" 00:00:00").append("$lte", beforDate+" 23:59:59"));
		dbo.put("baby_id", new BasicDBObject("$exists", true));
		list.add(dbo);
		BasicDBObject d = new BasicDBObject();
		d.put("$and", list);
		
		return MongoDBManager.findForCommitTime(collection, dbo);
	}
	
	/**
	 * 查询所有园所信息
	 * @param collection 表名
	 * @return
	 */
	public List<DBObject> findMongodbSchool(String collection){
	
		return MongoDBManager.findForCommitTime(collection, new BasicDBObject());
	}
	
	/**
	 * 查询所有园所信息
	 * @param collection 表名
	 * @return
	 */
	public List<DBObject> findMongodbBaby(String collection){
	
		return MongoDBManager.findForCommitTime(collection, new BasicDBObject());
	}
}
